package com.heima.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *  将Servlet配置成启动时加载
 *
 *
 */
public class InitServlet extends HttpServlet {

    @Override
    public void init() throws ServletException {
        //初始化一个值为0
        int count = 0;
        //将这个值存入到ServletContext域中
        this.getServletContext().setAttribute("count",count);


    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
